package com.czy.daishusys.entity.generator;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.czy.daishusys.R;
import com.czy.daishusys.ui.bottom.HomeFragment;
import com.czy.daishusys.ui.bottom.MessageFragment;
import com.czy.daishusys.ui.bottom.PersonFragment;


/**
 * Created by wangayng on 2017/11/23 0002.
 * 首页底部数据源
 */

public class DataGenerator {
    public static final int []mTabRes = new int[]{R.mipmap.icon_home_normal,R.mipmap.icon_message_normal,R.mipmap.icon_person_normal};
    public static final int []mTabResPressed = new int[]{R.mipmap.icon_home_selector,R.mipmap.icon_message_selector,R.mipmap.icon_person_selector};
    public static final String []mTabTitle = new String[]{"首页","消息","我的"};

    public static Fragment[] getFragments(){
        Fragment fragments[] = new Fragment[3];
        fragments[0] = new HomeFragment();
        fragments[1] = new MessageFragment();
        fragments[2] = new PersonFragment();
        return fragments;
    }
    //
//    /**
//     * 获取Tab 显示的内容
//     * @param context
//     * @param position
//     * @return
//     */
    public static View getTabView(Context context, int position){
        View view = LayoutInflater.from(context).inflate(R.layout.item_main_tablayout,null);
        ImageView tabIcon = (ImageView) view.findViewById(R.id.tab_image);
        tabIcon.setImageResource(DataGenerator.mTabRes[position]);
        TextView tabText = (TextView) view.findViewById(R.id.tab_title);
        tabText.setText(mTabTitle[position]);
        return view;
    }
}
